#ifndef WORDS_H
#define WORDS_H

#include <QObject>
#include <QXmlStreamReader>
#include <QMap>
#include <QWebPage>
#include <QWebFrame>

#include <QDebug>

class Words: public QObject
{
    Q_OBJECT

private:
    QList< QMap<QString,QString> > m_words;
    QWebPage* m_webPage;
    QMap<QString, QString> parseWord(QXmlStreamReader& xml);
    void addElementDataToMap(QXmlStreamReader& xml, QMap<QString, QString> &word);
    QString findWordInList(const QString word);

    void removeBackground(QString &definition);
    void removeImg(QString &definition);
public:
    Words();
    void processXML();    
public slots:
     void searchWord(const QString &msg);
     void searchOnWeb(const QString &msg);
     void parsePage(bool);
signals:
     void updateTranslation(QVariant translation);
};

#endif // WORDS_H
